<template>
	<view>
		<view class="pay_box">
			<view class="payResImg">
				<image :src="payResImg"></image>
			</view>
			<view class="payResTxt">{{payResTxt}}</view>
			<view class="btn_box">
				<u-button class="btn" @click="jumpPage(1)">返回首页</u-button>
				<u-button class="btn"  @click="jumpPage(2)">返回订单</u-button>
			</view>
			<u-button v-if="!isPayResult" class="payBtn" :custom-style="{width:'100%',background:'#20cbd4',color:'#fff'}" shape="circle">重新支付</u-button>
		</view>
		<hoverMenu></hoverMenu>
	</view>
</template>

<script>
	import hoverMenu from "@/components/public/sa-hover-menu.vue";
	import {isOrderDetail} from "@/common/api.js";
	export default {
		components: {
			hoverMenu
		},
		data() {
			return {
				isPayResult:true,
				payResTxt:"",
				payResImg:"",
				type:0, //0去订单页面1去秒杀订单
				order_id:""
			}
		},
		onLoad(option) {
			this.type = option.type
			if(this.isPayResult){
				this.payResImg=getApp().globalData.imageUrl+"order_pay_success.gif";
				this.payResTxt="支付成功"
			}else{
				this.payResImg=getApp().globalData.imageUrl+"order_pay_fail.gif";
				this.payResTxt="支付失败"
			}
			this.order_id = option.order_id
		},
		onShow() {
			// #ifdef APP-PLUS
			if(this.order_id != undefined){
				isOrderDetail(this,{order_id:this.order_id})
			}
			// #endif
		},
		methods: {
			floatTouchClick(index){
				this.$uniApi.floatTouch(index);
			},
			jumpPage(index){
				if(index==1){
					uni.switchTab({
						url:"/pages/tabBar/home"
					})
				}else if(index==2){
					if(this.type == 0){
						uni.navigateTo({
							url:"/user/orderlist"
						})
					}else if(this.type == 1){
						uni.navigateTo({
							url:"/user/seckillOrderList?swiperCurrent=0"
						})
					}else if(this.type == 10){
						uni.navigateTo({
							url:"/presell/presellOrder"
						})
					}else if(this.type == 11){
						uni.navigateTo({
							url:"/exchange/exchangeOrder"
						})
					}else{
						uni.navigateTo({
							url:"/user/sharingOrderList?swiperCurrent=0"
						})
					}
				}
			}
		}
	}
</script>

<style>
	page{
		font-family: PingFang SC;
		/* #ifndef H5 */
		background: linear-gradient(180deg,#6de3e9,#a0edf1 25%,#fff 98%);
		/* #endif */
		/* #ifdef H5 */
		background: #20cbd4;
		/* #endif */
		
	}
	.pay_box{
		background-color: #fff;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin: 380rpx 100rpx;
		padding: 100rpx ;
		border-radius: 20rpx;
	}
	.payResImg{
		width: 200rpx;
		height: 200rpx;
		margin-bottom: 30rpx;
	}
	.payResImg image{
		width: 100%;
		height: 100%;
	}
	.payResTxt{
		font-size: 45rpx;
		font-weight: 600;
		color: #20CBD4;
	}
	.btn_box{
		display: flex;
		justify-content: space-between;
		margin-top: 100rpx;
	}
	.btn{
		margin:0 20rpx;
	}
	.payBtn{
		margin-top: 50rpx;
	}
</style>
